cmake_minimum_required(VERSION 3.22)
set(PROJECT_NAME c_web_server)
project(${PROJECT_NAME} C)

add_executable(${PROJECT_NAME} main.c)

set(CMAKE_C_STANDARD 11)


#再LIB_PATH路径下寻找库LIB_NAME 找到则链接 找不到就报错
function(aut_find_link_lib LIB_NAME LIB_PATH)
    # 查找  库
    find_library(TIME_LIB ${LIB_NAME}  PATHS ${CMAKE_SOURCE_DIR}/lib)
    # 确保 TIME_LIB 变量包含库的路径
    if(TIME_LIB)
        # 将库链接到你的可执行文件
        target_link_libraries(${PROJECT_NAME} ${TIME_LIB})
        message("[FATAL_DEBUG] ${LIB_NAME}  has been add!")
    else()
        message("[FATAL_ERROR] ${LIB_NAME}  library not found at ${LIB_PATH}")
    endif()
endfunction()
set(CMAKE_LIBRARY_PATH "/app/lib/")
set(CMAKE_LIBRARY_INCLUDE "/app/include/")


aut_find_link_lib(Mlib ${CMAKE_LIBRARY_PATH})
target_link_libraries(${PROJECT_NAME} pthread)


include_directories(${CMAKE_LIBRARY_INCLUDE})






